//
//  MyInfoHeaderView.m
//  Mtime2.0
//
//  Created by 凉气的Mac on 16/9/21.
//  Copyright © 2016年 凉气的Mac. All rights reserved.
//

#import "MyInfoHeaderView.h"

@implementation MyInfoHeaderView


-(instancetype)initWithFrame:(CGRect)frame{
    
    if (self = [super initWithFrame:frame]) {
        
        //设置界面
        [self setupUI];
        
    }
    return self;
}

#pragma mark --
#pragma mark --设置界面
-(void)setupUI{
    
    UIImageView *backGround = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"icon_myinfo_top"]];
    
    [self addSubview:backGround];
    
    [backGround mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.edges.equalTo(self);
        
    }];
    
//    UIImageView *message = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"icon_my_message"]];
//    
//    [self addSubview:message];
//    
//    [message mas_makeConstraints:^(MASConstraintMaker *make) {
//        
//        make.height.equalTo(@20);
//        
//        make.height.equalTo(@25);
//        
//        make.top.equalTo(self).offset(25);
//        
//        make.right.equalTo(self).offset(-25);
//        
//    }];
    
    
    UIImageView *userIcon = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"icon_avatar_default_image_55x55"]];
    
    [self addSubview:userIcon];
    
    [userIcon mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerY.equalTo(self);
        
        make.left.equalTo(self).offset(40);
        
        make.height.width.equalTo(@60);
        
    }];
    
    UILabel *nameLabel = [[UILabel alloc]init];
    
    nameLabel.text = @"昵称";
    
    nameLabel.textColor = [UIColor whiteColor];
    
    [self addSubview:nameLabel];
    
    [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(userIcon).offset(5);
        
        make.left.equalTo(userIcon.mas_right).offset(15);
        
    }];
    
    
    //余额
    UILabel *balanceLabel = [[UILabel alloc]init];
    
    balanceLabel.textColor = [UIColor whiteColor];
    
    balanceLabel.text = @"余额:   ¥0";
    
    balanceLabel.font = [UIFont systemFontOfSize:12];

    [self addSubview:balanceLabel];
    
    [balanceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(nameLabel.mas_bottom).offset(15);
        
        make.left.equalTo(nameLabel);
        
    }];
    
    
    //充值
    UIButton *topupBtn = [[UIButton alloc]init];
    
    [topupBtn setTitle:@"充值" forState:UIControlStateNormal];
    
    topupBtn.layer.cornerRadius = 15;
    
    topupBtn.clipsToBounds = YES;

    [topupBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    
    [topupBtn setBackgroundColor:[UIColor orangeColor]];
    
    [self addSubview:topupBtn];
    
    [topupBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.bottom.equalTo(userIcon);
        
        make.left.equalTo(balanceLabel.mas_right).offset(15);
        
        make.height.equalTo(@30);
        
        make.width.equalTo(@80);
        
    }];
}



@end































